﻿@model NFine.Domain.Entity.ProductManage.ProductEntity
@{
    ViewBag.Title = Model.F_ProductName + "-详情";
    Layout = "~/Areas/WeiXinAreas/Views/Shared/_LayoutWeui.cshtml";
}
<style>
    body {
        background: #f2f2f2;
        overflow: auto;
        -webkit-overflow-scrolling: touch;
    }

    .pro_info {
        width: 100%;
    }

        .pro_info img {
            width: 100%;
            display: block;
            margin: 0.2rem auto;
        }

    .white-bg {
        background: #fff;
    }

    .pro_info_title {
        padding: 0 0.5rem;
        padding-top: 0.5rem;
    }

    .pro_info_price {
        color: #f60;
        font-size: 0.8125rem;
        font-weight: normal;
        padding: 0 0.5rem;
        padding-bottom: 0.5rem;
    }

        .pro_info_price del {
            color: #cccccc;
            font-size: 0.6125rem;
            margin-left: 0.2rem;
        }

    .pro_info_detail {
        margin-top: 0.5rem;
        height: 100%;
    }

        .pro_info_detail > .detail_title {
            font-size: 0.7125rem;
            padding: 0.5rem;
        }

        .pro_info_detail > .detail_info {
            font-size: 0.6125rem;
            padding: 0.5rem;
            padding-top: 0;
            overflow-x: hidden;
            color: #c0c0c0;
            margin-bottom: 5px;
        }

    .foot {
        height: 2.5rem;
        position: fixed;
        bottom: 0px;
        width: 100%;
        left: 0;
        text-align: center;
        line-height: 2.5rem;
    }
    .weui-toast{
      margin-left:auto;
    }
</style>
<div class="swiper-container swiper-container-horizontal" style="width:100%;">
    <div class="swiper-wrapper" style="transition-duration: 0ms; transform: translate3d(0px, 0px, 0px);">
        @*<div class="swiper-slide"><img class="square-box one-one bgimg-contain " style="width:100%;" src="~/Content/img/weipayimg.png" /></div>
            <div class="swiper-slide"><img class="square-box one-one bgimg-contain " style="width:100%; " src="~/Content/img/weipayimg.png" /></div>*@
        @foreach (var path in (List<string>)ViewData["images"])
        {
            <div class="swiper-slide"><img class="square-box one-one bgimg-contain " style="width:100%;" src="@path" /></div>
        }
    </div>
    <div class="swiper-pagination">
    </div>
</div>
<div class="white-bg pro_info_title ellipsis">
    @Model.F_ProductName
</div>
<div class="white-bg pro_info_price">
    ￥@Model.F_Price.GetValueOrDefault().ToString("#0.00")
</div>

<div class="white-bg pro_info_detail">
    <div class="detail_title">商品详情</div>
    <div class="detail_info">
        @Html.Raw(Model.F_Description)
    </div>
</div>

<div style="height:3rem;"></div>
<div id="divBuy" class="foot"><div style="width:50%; float:left;">
    <a class="weui-btn weui-btn_default" href="tel:@ViewData["kefutel"]" style="height:2.5rem;">
        联系客服
    </a>
</div>
    <div style="width:50%; float:right;">
        <a class="weui-btn weui-btn_primary" href="~/WeiXinAreas/Main/CreateOrder?pid=@Model.F_Id" style="height:2.5rem;background-color:#35a4fe" data-id="@Model.F_Id" data-type="@Model.F_TypeId" data-amount="@Model.F_Price">
            立即购买
        </a>
    </div>
</div>
@section footScript
{
    <script src="//cdn.bootcss.com/jquery-weui/1.0.1/js/swiper.min.js"> </script>
    <script type="text/javascript">
        $(function () {
            var mySwiper = new Swiper('.swiper-container', {
                direction: 'horizontal',
                loop: false,
                pagination: '.swiper-pagination',
                paginationClickable: true,
                spaceBetween: 30,
                centeredSlides: true,
                autoplay: 2500,
                autoplayDisableOnInteraction: false
            });
            var $SubBtn = $('#btnSub');
            $SubBtn.bind('click', function () {
                var model = {};
                model.F_ProductId = $SubBtn.attr('data-id');
                model.F_Producttype = $SubBtn.attr('data-type');
                model.F_money = $SubBtn.attr('data-amount');
                model.F_State = 0;
                $.ajax({
                    type: 'post',
                    url: "/WeiXinAreas/Main/SubmitBuyApply",
                    data: JSON.stringify(model),
                    dataType: "json",
                    cache: false,
                    beforeSend: function () {
                        $.showLoading();
                    },
                    success: function (data) {
                        var _msg = data.msg;
                        var _success = data.result;
                        if (_success) {
                            location.href = '/WeiXinAreas/Main/ShowQrcode?price=' + model.F_money;
                        } else {
                            $.alert(_msg, '提示');
                        }
                    },
                    error: function (a, b, c) {
                        $.alert([a, b, c].join('|'));
                    },
                    complete: function () {
                        $.hideLoading(); 
                    }
                });
            });
        });

    </script>
}
